/**
 * @author ccpalu
 */
function accessUCSC(){
	var headID = document.getElementsByTagName("head")[0];
	var script = document.createElement('script');
	script.id = 'AccessUCSC';
//	var src="http://ibl.mdanderson.org/~mhdeus/cintia/download.php?callback=goToUcsc";
	var src="http://odin.mdacc.tmc.edu/~ccpalu/CNViewer/download.php?callback=goToUcsc";
	script.name="ucsc";
	script.type = 'text/javascript';
	script.src = src;
	headID.appendChild(script);
	remove_element_by_id('AccessUCSC');

	return false;
}

function goToUcsc(ans){

	var chChecked = markChecked();
	var cnv= document.getElementById('CNV');
	var url;

	for (var i = 0; i < chChecked.length; i = i + 1) {
	
		for (var j = 0; j < cnv.chRegions[chChecked[i]].length; j = j + 2) {
			url = 'http://genome.ucsc.edu/cgi-bin/hgTracks?hgsid=' + ans +
			'Submit=go+to+genome+browser&db=hg18&position=chr' +
			chChecked[i] +
			':' +
			cnv.chRegions[chChecked[i]][j] +
			'-' +
			cnv.chRegions[chChecked[i]][j + 1];
			var gbPopup = window.open(url);

			//Checking if the pop-up blocker is disabled
			if (gbPopup == null || typeof(gbPopup) == 'undefined'){
				alert ('Please disable your pop-up blocker and click at the "UCSC Genome Browser" again.');
			}
			else{
				gbPopup.focus();
			}
		}
	}

	return false;
}
